package Array_Object;

/**
 * ClassName:PhoneTest
 * Package:Array_Object
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/1/15-14:59
 * @Version:v1.0
 */
public class PhoneTest {
    public static void main(String[] args) {
        Phone[] arr = new Phone[3];
        Phone p1 = new Phone("小米", 2000, "黑色");
        Phone p2 = new Phone("华为", 2999, "玫瑰金");
        Phone p3 = new Phone("魅族", 1500, "白色");
        arr[0] = p1;
        arr[1] = p2;
        arr[2] = p3;
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            Phone phone = arr[i];
            sum += phone.getPrices();
        }
        double avg = sum*1.0/arr.length;
        System.out.println(avg);
    }


}
